<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/11/2
 * Time: 10:36
 */
namespace app\v1\controller;

use think\Request;

class Merchantpay extends \think\Controller
{
    private function getBusinesspay()
    {
        return model("Businesspay");
    }

    /*
     * 订单方法
     * */
    public function order(Request $request)
    {

        if ($request->isPost()) {//创建

            return json_encode($this->getBusinesspay()->addBusinesspay($request->param()));

        } else if ($request->isGet()) {//获取

            if (is_numeric($request->param("orderStatus"))) {
                //获取指定类型的数据
                return json_encode($this->getBusinesspay()->optionsBusinesspay($request->param()));
            } else {
                return json_encode($this->getBusinesspay()->getBusinesspayById($request->param("_id")));
            }
        } else if ($request->isDelete()) {//删除
            return json_encode($this->getBusinesspay()->delBusinesspay($request->param("_id")));
        } else if ($request->isPut()) {//更新写入
            return json_encode($this->getBusinesspay()->putBusinesspay($request->param()));
        }
    }


}